﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

using My.ELibrary.Model.Catalog;
using My.ELibrary.Business.Catalog;

public partial class Catalog_Catalog : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetBookOne();
        }
    }

    private void GetBookOne()
    {
        List<ElibResBookModel> GetElibBookList = new List<ElibResBookModel>();
        GetElibBookList = ElibResBookBLL.GetInstance().GetElibBook();
        this.DataList1.DataSource = GetElibBookList;
        this.DataList1.DataBind();
         
    }

    protected string GetBookTwo(string twoType,string id)
    {
        List<ElibResBookModel> GetElibBookList = new List<ElibResBookModel>();
        GetElibBookList = ElibResBookBLL.GetInstance().GetElibTwoBook(int.Parse(twoType));
        string html = " <a href='BookList.aspx?TypeOne={0}&TypeTwo={1}&id={2}' target='_blank' class='t1'>{3}</a> | ";

        string Header = string.Empty;
        if (GetElibBookList != null && GetElibBookList.Count > 0)
        {
            foreach (ElibResBookModel obj in GetElibBookList)
            {
                Header += string.Format(html, obj.GroupOne,obj.GroupTwo,obj.Id.ToString() ,obj.Subject);
            }
        }
        return Header;
    }
}
